<template>
  <div>个人主页</div>
  <div>
    <!-- {{ list }} -->
  </div>
  <!-- 数据列表 -->
</template>

<script setup lang="ts">
import { Api } from '@/types/Api'
import type { BaseDataResult, PageBean, PageVO } from '@/types/BaseResult'
import type { TbMessage } from '@/types/message'
import { onMounted, ref } from 'vue'

import { useRoute } from 'vue-router'

const route = useRoute()

const uid = route.params.uid
console.log('用户id:', uid)

const loading = ref(false)
// 查询的部分
const page = ref({ pageNumber: 1, pageSize: 10 } as PageBean)
const list = ref([] as TbMessage[])
const queryInfo = ref({ order: 1, title: '' })

const query = () => {
  loading.value = true
  Api.get(
    `/message/user/${uid}/${page.value.pageSize}/${page.value.pageNumber}/1`,
    { title: queryInfo.value.title },
    (data: BaseDataResult<PageVO<TbMessage>>) => {
      loading.value = false
      if (data.success) {
      }
      list.value = data.data.list
      page.value = data.data.pageBean
    },
  )
}

onMounted(() => {
  query()
})
</script>

<style scoped></style>
